window.onload = function () {
    
    let review = document.querySelector('.review');
    let username = document.querySelector('.username');
    let con = document.querySelector('.con');


    async function getData(){
    let res1 = await pAjax({
        url:'/zc/review.php'
    });

    
    console.log(res1);
    }
    getData();  
        
    let p = pAjax({
        url: "/zc/review.php",
        type: "get",
        
    });
    p.then(function (res) {
        res = JSON.parse(res);
        console.log(res);
        render(res);
        // let name = res.username;
        // console.log(name);
        // let review = res.review;
        // console.log(review);
        // 
    });

    function render(data) {
        let str = '';
        data.forEach(function (item) {
            str += `
                <span class="review">${item.review}</span>
                <span class="username">${item.username}</span>
                `;
        });
        
        con.innerHTML = str;
    }

}